// component/ui/z-button/z-button.js
Component({
  /**
   * 组件的配置
   */
  options: {
    styleIsolation: 'isolated',
    pureDataPattern: /^_/
  },

  
  /**
   * 组件的传入样式
   */
  externalClasses: ['extra-style'],

  /**
   * 组件的属性列表
   */
  properties: {
    name: {
      type: String,
      value: ''
    },
    plain: {
      type: Boolean,
      value: false,
    },
    round: {
      type: Boolean,
      value: false,
    },
    loading: {
      type: Boolean,
      value: false,
    },
    disabled: {
      type: Boolean,
      value: false,
    },
    size: {
      type: String,
      value: 'normal' // normal,full,large,big,small,mini
    },
    color: {
      type: String,
      value: ''
    },
    type: {
      type: String,
      value: 'default' // default,primary,info,warning,danger
    }
  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    onClick() {
      const {
        loading,
        name,
        disabled
      } = this.data
      if (!loading && !disabled) {
        this.triggerEvent('click', name);
      }
    },
  }
})